<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String orderNo = request.getParameter("orderNo");
String createTime = request.getParameter("createTime");
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description" />
<meta content="B2B电商平台" name="keyword" />

<title>B2B电商平台.订单优惠详情</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/pro.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/proManage.css" />
<link rel="stylesheet" href="<%=path%>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css" type="text/css"></link>
<link rel="stylesheet" type="text/css" href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/mmt_trading.css" />
<link rel="stylesheet" type="text/css" href="http://style.org.hc360.com/js/build/source/widgets/wij/hc.wijmo.css" />
<link rel="stylesheet" type="text/css" href="http://style.org.hc360.com/js/build/source/widgets/wij/hc.wijcalendar.css" />
<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script src="<%=path %>/include/wijmo/external/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/external/globalize.min.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/external/cultures/globalize.cultures.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/wijmo/jquery.wijmo.wijpopup.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/wijmo/jquery.wijmo.wijcalendar.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/init.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/doT.min.js"></script>
<script type="text/javascript" src="<%=path%>/include/layer/layer.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/json2.js"></script>
<script src="<%=path%>/include/DatePicker/WdatePicker.js" charset="UTF-8" type="text/javascript"></script>

<style type="text/css">

.colnums-2-ab-b {
	float: left;
	width: 100%;
	height: auto;
	font-size: 12px !important;
}

.listed_tb_k th.t1 {
	width: 44%;
	border-right: 0px solid #fff;
	padding: 0 5px;
}

.listed_tb_k th.t2 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t3 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t4 {
	width: 12%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t5 {
	width: 12%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t6 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t7 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k tbody td.t2 .pic_50 {
	border: 1px solid #FFF;
	width: 50px;
	height: 50px;
	display: table-cell;
	vertical-align: middle;
	text-align: center;
	background-color: #fff;
}

.t4 {
	border-right: 1px solid #ddd;
}

.t5 {
	border-right: 1px solid #ddd;
}

.t6 {
	border-right: 1px solid #ddd;
}

.t7 {
	border-right: 1px solid #ddd;
}

#ajaxSerieslist td {
	border: 1px solid #ddd;
}

thead th {
	border: 1px solid #ddd;
	padding: 4px;
}

.sear {
	border: 1px solid #e0e0e0;
	background: #f5f5f5;
	margin-top: 10px;
	height: 80px;
	line-height: 40px;
	font-size: 14px;
}

</style>

<script type="text/javascript">
	$(document).ready(function() {
		_reHeight("rightFrame","contentDiv");
		
		_queryList();
	});

    var pagination;
	function _queryList(){
  		var url = "<%=path %>/orderList/getDiscountList.do?orderNo=<%=orderNo%>";
  		pagination = _initPagination({'pageId':'pagination', 'cKey':'toOrderList','url': url, 'rows': 10, 'callback':_initDataList});
	}
	
	function _initDataList(data) {
 		var d = data.rows;
 		var orderList = d[0];
 		var orderCount = orderList.length;
 		var discountList = d[1];
 		var discountCount = discountList.length;
		$("#ajaxSerieslist").empty();
		var addressSpan = '';
		var str = '';
		for(var i=0; i < orderCount; i++){
			if(i == 0){
				//第一条商品信息
				str += "<tr>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PROMOTION_PRICE +"</td>";
				str += "	<td  style='text-align:center;vertical-align:middle;'>";
				str += "		<div  style='float:left;padding: 6px;'>";
				if(orderList[i].PRODUCT_PIC==undefined){
					str += "		<img src='<%=path%>/download/error/nopicture.jpg' width='50' height='43.5' alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				} else {
					str += "		<img src='" + orderList[i].PRODUCT_PIC+"' width='50' height='50' alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				}
				str += "		</div>";
				str += "		<div  style='text-align: left;float:left;vertical-align:middle;padding-top:15px;'>";
				str += "			<p>"+ orderList[i].PRODUCT_NAME +"</p>";
				str += "		</div>";
				str += "	</td>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PRODUCT_PRICE +"</td>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PROMOTION_PRICE + "*" + orderList[i].SELL_AMOUNT +"</td>";
				str += "	<td style='text-align:left;vertical-align:middle;padding-left:4px;' rowspan='"+orderCount+"' >";
				if(parseInt(discountCount) > parseInt(0)){
					for(var j = 0; j < discountCount; j++){
						if(j != 0){
							str += '<br>';
						}
						str += '<span>';
						str += '&nbsp;' + (j+1) + '、活动名称：' + discountList[j].YH_NAME + '，优惠方式：';
						if(discountList[j].YH_TYPE == '1'){
							str += '使用优惠券，';
						}else if(discountList[j].YH_TYPE == '2'){
							str += '满减，';
						}else if(discountList[j].YH_TYPE == '3'){
							str += '满返，';
						}else if(discountList[j].YH_TYPE == '4'){
							str += '订单折扣，';
						}
						str += '优惠金额：' +　discountList[j].YH_MONEY + '元';
						str += '</span>';
					}
				}else {
					str += "&nbsp;无优惠记录";
				}
				str += "	</td>";
				str += "</tr>";
			}else{
				str += "<tr>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PROMOTION_PRICE +"</td>";
				str += "	<td  style='text-align:center;vertical-align:middle;'>";
				str += "		<div  style='float:left;padding: 6px;'>";
				if(orderList[i].PRODUCT_PIC==undefined){
					str += "		<img src='<%=path%>/download/error/nopicture.jpg' width='50' height='43.5' alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				} else {
					str += "		<img src='" + orderList[i].PRODUCT_PIC+"' width='50' height='50' alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				}
				str += "		</div>";
				str += "		<div  style='text-align: left;float:left;vertical-align:middle;padding-top:15px;'>";
				str += "			<p>"+ orderList[i].PRODUCT_NAME +"</p>";
				str += "		</div>";
				str += "	</td>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PRODUCT_PRICE +"</td>";
				str += "	<td style='text-align:center;vertical-align:middle' >"+ orderList[i].PROMOTION_PRICE + "*" + orderList[i].SELL_AMOUNT +"</td>";
				str += "</tr>";
			}
		}	
		$("#ajaxSerieslist").append(str);
		_reHeight("rightFrame", "contentDiv");
		//_reHeight();
	 }
	
	function _reHeight() {
		var main = $(window.parent.document).find("#rightFrame");
		var mainheight = $("#contentDiv").height() + 40;
		main.height(mainheight);
	}
	
	function _returnPage(){
		var url = "<%=path%>/orderList/showDetail.do?orderNo=<%=orderNo%>";
		location.href = url;
	}
	
</script>
</head>

<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:5px; width:99%;">
		<div class="colnums-2-ab-b">
		
			<div id="msgDiv" style="margin-top:5px;width:100%;padding:1%;border:none;">
				<div style="height:40px;line-height:40px;font-size:14px;margin-left:2px;">
					<span style="font-weight:bold;height:30px;line-height:30px;display:inline-block;">订单编号：</span><span id="orderNo"><%=orderNo %></span><br>
					<span style="font-weight:bold;height:30px;line-height:30px;display:inline-block;">成交时间：</span><span id="createTime"><%=createTime%></span>
				</div>
				<div style="height:40px;line-height:40px;font-size:14px;margin-right:10px;text-align:right;">
					<button id="queryBtn" class="orange_search_btn3" onclick="_returnPage()">返回</button>				
				</div>
			</div>
			<div id="buyerDiv" style="width:100%;border:1px solid #ccc;padding:1%;border:none;">
			</div>
			<div id="orderDiv" class="listed_tb_k" style="padding:1%;margin-top:0px;width:99.5%;border:none;">
				<table cellspacing="0" cellpadding="0" width="100%">
					<thead>
						<tr>
							<th style="text-align:center;vertical-align:middle;width:10%;" nowrap>订单价格</th>
							<th style="text-align:center;vertical-align:middle;width:20%;" nowrap>宝贝</th>
							<th style="text-align:center;vertical-align:middle;width:10%;" nowrap>宝贝价格</th>
							<th style="text-align:center;vertical-align:middle;width:15%;" nowrap>成交价格*数量</th>
							<th style="text-align:center;vertical-align:middle;width:45%;" nowrap>优惠内容</th>
						</tr>
					</thead>
					<tbody id="ajaxSerieslist">
					</tbody>
				</table>
			</div>
			<div class="sort_page">
				<div class="bottom_page">
					<div id="pagination"></div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
